<div class="portlet">
    <div class="portlet-actions">
        <button class="btn blue btn-sm" ng-click="grid.add()"><i class="fa fa-plus"></i> 报修</button>
    </div>
    <form class="portlet-search-body" name="queryForm">
        <input type="text" class="form-control search-item" ng-model="vehicleNo" placeholder="自编号">
        <input type="text" class="form-control search-item" ng-model="applyCompany" placeholder="报修单位">
		<select class="form-control search-item" ng-model="customerId"
				ng-options="opt.customerId as opt.customerName for opt in customerList">
			<option value="" disabled selected hidden>-- 客户名称 --</option>
		</select>
        <div class="search-item">
            <button class="btn btn-icon-only default"><i class="fa fa-chevron-right"></i></button>
            <button class="btn btn-sm query" ng-click="grid.query();"><i class="fa fa-search"></i> 查询</button>
            <button class="btn btn-sm reset" ng-click="grid.reset();"><i class="fa fa-eraser"></i> 重置</button>
        </div>
    </form>
    <div class="portlet-body">
        <table ed-grid="grid"  class="table table-striped table-bordered table-advance table-hover"
               data-options="url: 'maintenanceApply/query.do', modelText: '申请单列表', form: 'queryForm'">
            <thead>
            <tr>
                <th data-options="field: '_index'"></th>
                <th data-options="field: 'applyCompany'">报修单位</th>
                <th data-options="field: 'customerName'">客户名称</th>
                <th data-options="field: 'description'">报修描述</th>
                <th data-options="field: 'adName'">广告内容</th>
                <th data-options="field: 'vehicleNo'">自编号</th>
                <th data-options="field: 'vehicleNoAbbr'">小自编号</th>
                <th data-options="field: 'plateNo'">车牌号</th>
                <th data-options="field: 'lineNo'">线路号</th>
                <th data-options="field: 'companyName'">经营单位</th>
                <th data-options="field: 'status | code : mt_status'">状态</th>
                <th width="180px">操作</th>
            </tr>
            </thead>
        </table>
    </div>
</div>

<div ed-modal="applyModal" data-options="title: '维修申请', static: true, width: 1000, defaultButton:false">
    <form action="#" class="form-horizontal w5c-form" w5c-form-validate novalidate name="validateForm">
        <div class="form-body">
        	<div class="form-group">
				<label class="col-md-2 control-label">报修单位</label>
				<div class="col-md-4">
					<input type="text" class="form-control" name="applyCompany" ng-model="maintenanceApply.applyCompany" required>
            	</div>
				<label class="col-md-2 control-label">计划修补时间</label>
				<div class="col-md-4">
					<input type="text" ed-date-picker class="form-control" name="planRepairTime" ng-model="maintenanceApply.planRepairTime" required>
				</div>
            </div>
        	<div class="form-group">
				<label class="col-md-2 control-label">报修描述</label>
				<div class="col-md-10">
					<textarea class="form-control" name="description" ng-model="maintenanceApply.description">
					</textarea>
            	</div>
            </div>
			<div class="card" style="margin-bottom: 0">
				<div class="card-header">
					<h4>媒体</h4>
				</div>
			</div>
			<div class="portlet" style="height: 250px;">
				<form class="portlet-search-body" name="queryForm">
					<input type="text" style="width: 200px;display: inline-block" class="form-control search-item" ng-model="busObj.vehicleNo" placeholder="自编号">
					<input type="text" style="width: 200px;display: inline-block" class="form-control search-item" ng-model="busObj.vehicleNoAbbr" placeholder="小自编号">
					<input type="text" style="width: 200px;display: inline-block" class="form-control search-item" ng-model="busObj.plateNo" placeholder="车牌号">
					<div class="search-item" style="float: right">
						<button type="button" class="btn btn-sm query" ng-click="busObj.query();"><i class="fa fa-search"></i> 查询</button>
						<button type="button" class="btn btn-sm reset" ng-click="busObj.reset();"><i class="fa fa-eraser"></i> 重置</button>
					</div>
				</form>
				<div class="portlet-body" style="padding-top: 7px;">
					<table style="width: 100%"  class="table table-striped table-bordered table-advance table-hover">
						<thead>
							<tr>
								<th></th>
								<th>自编号</th>
								<th>小自编号</th>
								<th>车牌号</th>
								<th>线路号</th>
								<th>经营单位</th>
								<th>客户名称</th>
								<th>广告内容</th>
								<th>发布形式</th>
								<th>制作形式</th>
								<th>胶贴形式</th>
							</tr>
						</thead>
						<tbody>
							<tr ng-repeat="bus in busList">
								<td><input type="checkbox" name="checkBus" ng-checked="bus.show_{{bus.busId}}" ng-click="busObj.click(bus,$event)"></td>
								<td>{{bus.vehicleNo}}</td>
								<td>{{bus.vehicleNoAbbr}}</td>
								<td>{{bus.plateNo}}</td>
								<td>{{bus.lineNo}}</td>
								<td>{{bus.companyName}}</td>
								<td>{{bus.customerName}}</td>
								<td>{{bus.adName}}</td>
								<td>{{bus.publishType}}</td>
								<td>{{bus.makeType}}</td>
								<td>{{bus.stickerType}}</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
        </div>
    </form>
</div>

<div ed-modal="dealModal" data-options="title: '报修单办理', static: true, width: 800, defaultButton:false,onHidden:'dealCancel'">
	<form action="#" class="form-horizontal w5c-form" w5c-form-validate novalidate name="dealValidateForm">
		<div class="form-body">
			<div class="form-group">
				<label class="col-md-2 control-label">报修单位:</label>
				<div class="col-md-4" style="padding-top: 9px;">
					<span>{{maintenanceDeal.applyCompany}}</span>
				</div>

				<label class="col-md-2 control-label">计划修补时间</label>
				<div class="col-md-4" style="padding-top: 9px;">
					{{maintenanceDeal.planRepairTime | limitTo : '10'}}
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-2 control-label">报修描述:</label>
				<div class="col-md-4" style="padding-top: 9px;">
					<span>{{maintenanceDeal.description}}</span>
				</div>
			</div>
			<div class="card" style="margin-bottom: 0">
				<div class="card-header">
					<h4>媒体</h4>
				</div>
			</div>
			<div class="portlet" style="height: 70px;">
				<div class="portlet-body" style="padding-top: 7px;">
					<table style="width: 100%"  class="table table-striped table-bordered table-advance table-hover">
						<thead>
							<tr>
								<th>自编号</th>
								<th>小自编号</th>
								<th>车牌号</th>
								<th>线路号</th>
								<th>经营单位</th>
								<th>客户名称</th>
								<th>广告内容</th>
								<th>发布形式</th>
								<th>制作形式</th>
								<th>胶贴形式</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>{{maintenanceDeal.bus.vehicleNo}}</td>
								<td>{{maintenanceDeal.bus.vehicleNoAbbr}}</td>
								<td>{{maintenanceDeal.bus.plateNo}}</td>
								<td>{{maintenanceDeal.bus.lineNo}}</td>
								<td>{{maintenanceDeal.bus.companyName}}</td>
								<td>{{maintenanceDeal.bus.customerName}}</td>
								<td>{{maintenanceDeal.bus.adName}}</td>
								<td>{{maintenanceDeal.bus.publishType}}</td>
								<td>{{maintenanceDeal.bus.makeType}}</td>
								<td>{{maintenanceDeal.bus.stickerType}}</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>

			<div class="card" style="margin-bottom: 0;padding-bottom: 0">
				<div class="card-header">
					<h4>分配任务</h4>
				</div>
			</div>

			<div class="portlet" style="height: 260px;overflow-y: auto">
				<div class="portlet-body" style="padding-top: 7px;">
					<table style="width: 100%"  class="table table-striped table-bordered table-advance table-hover">
						<thead>
							<tr>
								<th style="text-align: center">环节</th>
								<th style="text-align: center">任务</th>
								<th style="text-align: center">办理人/工作组</th>
								<th style="text-align: center">截止时间</th>
							</tr>
						</thead>
						<tbody>
							<td style="text-align: center;width: 100px;padding-top: 60px;" rowspan="{{workflow.steps.length + 1}}">
								<span style="position: relative;top: 2px;"><input style="margin-right: 4px;" type="checkbox" name="sticker" ng-click="clickSticker($event)"></span>胶贴制作
							</td>
							<tr ng-repeat="step in workflow.steps">
								<td style="text-align: center;width: 100px;padding-top: 15px;">
									{{step.taskName}}
									<!--<input style="margin-right: 4px;" type="checkbox" name="stepCheck" ng-click="clickStep(step,$event)">-->
								</td>
								<td style="width: 320px;">
									<div ed-combotree name="member" class="empListDiv" placeholder="办理人"
										 data-options="idField: 'id', textField: 'name', parentIdField: 'parentId',disabled:'true'"
										 ng-model="step.id" ed-selectable="selectable(data)" ed-data="empList"></div>

									<!--<select ng-disabled="!showStickerItem" style="color: gray;border-color: #e8750b" class="form-control" name="groupId" ng-model="step.groupId"-->
											<!--ng-options="opt.groupId as opt.groupName for opt in groupList">-->
										<!--<option value="" disabled selected hidden>&#45;&#45; 工作组 &#45;&#45;</option>-->
									<!--</select>-->
								</td>
								<td>
									<input ng-disabled="!showStickerItem" ng-style="{'border-color': showStickerItem ? '#e8750b' : ''}" class="form-control" type="text" ed-date-picker name="limitTime" ng-model="step.limitTime">
								</td>
							</tr>
							<tr>
								<td style="text-align: center;width: 100px;padding-top: 13px;">
									广告修补
								</td>
								<td style="text-align: center;width: 70px;padding-top: 15px;">
									修补任务
								</td>
								<td style="width: 200px;">
									<select style="color: gray;border-color:#e8750b;" class="form-control" name="groupId" ng-model="maintenanceDeal.publishTask.groupId"
											ng-options="opt.groupId as opt.groupName for opt in groupList">
										<option value="" disabled selected hidden>-- 工作组 --</option>
									</select>
								</td>
								<td>
									<input style="border-color:#e8750b;" class="form-control" type="text" ed-date-picker name="limitTime" ng-model="maintenanceDeal.publishTask.limitTime">
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
		</div>

		<div class="form-actions">
			<button type="button" class="btn default" ng-click="dealCancel();">
				<i class="fa fa-times"></i> 取消
			</button>
			<button type="button" class="btn blue" ng-click="grid.dealSave();">
				<i class="fa fa-times"></i> 确定
			</button>
		</div>
	</form>
</div>

<div ed-modal="viewModal" data-options="title: '查看', static: true, width: 800, defaultButton:false">
	<tabset>
		<tab heading="申请单信息">
			<form action="#" class="form-horizontal w5c-form" w5c-form-validate novalidate name="viewValidateForm">
				<div class="form-body">
					<div class="form-group">
						<label class="col-md-2 control-label">报修单位:</label>
						<div class="col-md-4" style="padding-top: 9px;">
							<span>{{maintenanceView.applyCompany}}</span>
						</div>
						<label class="col-md-2 control-label">计划修补时间:</label>
						<div class="col-md-4" style="padding-top: 9px;">
							<span>{{maintenanceView.planRepairTime | limitTo : 10}}</span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label">报修描述:</label>
						<div class="col-md-4" style="padding-top: 9px;">
							<span>{{maintenanceView.description}}</span>
						</div>
					</div>
					<div class="card" style="margin-bottom: 0">
						<div class="card-header">
							<h4>媒体</h4>
						</div>
					</div>
					<div class="portlet" style="height: 70px;">
						<div class="portlet-body" style="padding-top: 7px;">
							<table style="width: 100%"  class="table table-striped table-bordered table-advance table-hover">
								<thead>
								<tr>
									<th>自编号</th>
									<th>小自编号</th>
									<th>车牌号</th>
									<th>线路号</th>
									<th>经营单位</th>
									<th>客户名称</th>
									<th>广告内容</th>
									<th>发布形式</th>
									<th>制作形式</th>
									<th>胶贴形式</th>
								</tr>
								</thead>
								<tbody>
								<tr>
									<td>{{maintenanceView.bus.vehicleNo}}</td>
									<td>{{maintenanceView.bus.vehicleNoAbbr}}</td>
									<td>{{maintenanceView.bus.plateNo}}</td>
									<td>{{maintenanceView.bus.lineNo}}</td>
									<td>{{maintenanceView.bus.companyName}}</td>
									<td>{{maintenanceView.bus.customerName}}</td>
									<td>{{maintenanceView.bus.adName}}</td>
									<td>{{maintenanceView.bus.publishType}}</td>
									<td>{{maintenanceView.bus.makeType}}</td>
									<td>{{maintenanceView.bus.stickerType}}</td>
								</tr>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</form>
		</tab>
		<tab heading="办理流程">
			<div style="height: 400px;overflow-y: auto;overflow-x: hidden">
				<div ng-repeat="task in maintenanceView.taskList">
					<div class="card" ng-style="{'height' : task.images.length > 0 ? '420px' : '150px','border-color': task.status == '2' ? 'green' : '#ddd'}" style="display: inline-block;width : 100%;border: 1px solid #DDDDDD;margin-top: 5px;">
						<div class="card-header" style="padding-left: 5px;">
							<h4>任务{{$index + 1}} : <span style="color: red">{{task.taskType | code : 'task_type'}}</span></h4>
						</div>
						<form action="#" class="form-horizontal w5c-form">
							<div class="form-body">
								<div class="form-group" style="margin-bottom: 0">
									<label class="col-md-2 control-label" ng-show="task.workGroupId != undefined && task.workGroupId != ''">工作组:</label>
									<div class="col-md-4" style="margin-top: 9px;" ng-show="task.workGroupId != undefined && task.workGroupId != ''">
										<span>{{task.groupName}}</span>
									</div>
									<label class="col-md-2 control-label">办理人:</label>
									<div class="col-md-4" style="margin-top: 9px;">
										<span ng-show="task.workDetails.length != 0" ng-style="{'color' : work.leaderFlag == '1' ? 'orangered' : ''}" style="margin-right: 8px;" ng-repeat="work in task.workDetails">{{work.empName}}</span>
										<span ng-show="task.workDetails.length == 0" style="margin-right: 8px;color:orangered">{{task.empName}}</span>
									</div>
								</div>
								<div class="form-group" style="margin-bottom: 0">
									<label class="col-md-2 control-label">开始时间:</label>
									<div class="col-md-4" style="margin-top: 9px;">
										<span>{{task.startTime}}</span>
									</div>
									<label class="col-md-2 control-label">结束时间:</label>
									<div class="col-md-4" style="margin-top: 9px;">
										<span>{{task.endTime}}</span>
									</div>
								</div>
								<div class="form-group" style="margin-bottom: 0">
									<label class="col-md-2 control-label">状态:</label>
									<div class="col-md-4" style="margin-top: 9px;">
										<span ng-style="{'color' : task.status == '2' ? 'green' : 'red' }">{{task.status | code : 'task_status'}}</span>
									</div>
									<label class="col-md-2 control-label">说明:</label>
									<div class="col-md-4" style="margin-top: 9px;">
										<span>{{task.comment}}</span>
									</div>
								</div>
								<div style="height: 320px;margin-top: 20px;" ng-show="task.images.length > 0">
									<div class="form-group">
										<label class="col-md-2 control-label">附件:</label>
										<div class="col-md-10">
											<div class="mix-grid" style="display: block;height: 280px;overflow-y: auto;overflow-x: hidden">
												<div class="mix" style="display: inline-block;opacity: 1;padding-right: 5px;" ng-repeat="img in task.images">
													<div class="mix-inner">
														<img class="img-responsive" ng-src="{{setting.nginxPath + img.path}}" alt="" style="width:150px;height:120px">
														<div class="mix-details" style="height:50%;">
															<a style="left: 33%" class="mix-preview fancybox-button" ng-href="{{setting.nginxPath + img.path}}" data-rel="fancybox-button">
																<i class="fa fa-search"></i>
															</a>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</form>
					</div>
					<div ng-show="$index != maintenanceView.taskList.length - 1" style="padding-top: 5px;text-align: center;">
						<img style="width: 40px;height: 40px;" src="assets/admin/img/2.jpg">
					</div>
				</div>
			</div>
		</tab>
	</tabset>
</div>

